<%--
  Created by IntelliJ IDEA.
  User: wangliang
  Date: 2019/11/11
  Time: 9:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <base href="<%=request.getContextPath()%>/"/>
</head>
<body>
    <div id="div1">

    </div>
    <div id="div2">
        等待秒杀
    </div>
</body>
</html>
<script>
    setInterval(fn1, 1000);

    var d = new Date();
    d.setDate(25);
    d.setHours(11);
    d.setMinutes(15);
    d.setSeconds(0);

    function fn1() {
        var now = new Date();
        var n = d.getTime() - now.getTime();
        n = n / 1000;
        n = parseInt(n);
        if(n <= 0){
            document.getElementById("div2").innerHTML = "<a href=\"kill\">开始秒杀</a>";
        }else{
            document.getElementById("div1").innerHTML = "离秒杀开始还有"+n+"秒";
        }

//        alert(111);

    }
</script>